Skip to content

feat: initial metric client implementation#4

Merged
jvanschie merged 1 commit into
mainfrom
feature/599-metric-service
May 27, 2026
Merged

feat: initial metric client implementation#4
jvanschie merged 1 commit into
mainfrom
feature/599-metric-service

Conversation

@jvanschie

@jvanschie jvanschie commented May 18, 2026

Copy link
Copy Markdown
Contributor

Change Description

Introduced mgo-metric-service, a Python metrics client library that decouples application code from metrics backends. Applications emit counters, gauges, and timings through a single MetricsClient API, with pluggable backends (StatsD, in-memory, no-op) and formatters for metric keys and tags.

Changes Made

  • Added MetricsClient with incr, gauge, and timing methods, optional tag support, and debug logging
  • Implemented backends: StatsDBackend (StatsD over UDP), InMemoryBackend (records calls for inspection), and NoopBackend (discards metrics)
  • Implemented formatters: StatsDFormatter (dot-separated keys with tag validation), InMemoryFormatter (human-readable keys for tests), and NoopFormatter formatting nothing.
  • Added FakeMetricsClient with assert_metric_call, assert_incr, assert_gauge, assert_timing, and reset for test assertions
  • Updated CI workflow to run make check (lint, format, mypy, pytest with coverage)
  • Updated README.md with installation, usage examples, and testing guidance

Testing Instructions for QA Team

This is a Python library, not a deployable HTTP service.
Verification is through automated checks or library usage.

Checklist

@jvanschie
jvanschie requested a review from a team May 18, 2026 14:26
@jvanschie jvanschie self-assigned this May 18, 2026
@jvanschie
jvanschie force-pushed the feature/599-metric-service branch from 44480ed to f680db7 Compare May 18, 2026 14:28
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@jvanschie
jvanschie force-pushed the feature/599-metric-service branch 8 times, most recently from 88221de to a8897ae Compare May 20, 2026 12:37
@jvanschie jvanschie changed the title feat: init metric service feat: initial metric client implementation May 20, 2026
@jvanschie
jvanschie marked this pull request as ready for review May 20, 2026 14:50
@jvanschie
jvanschie force-pushed the feature/599-metric-service branch 4 times, most recently from 164824e to 5454693 Compare May 20, 2026 15:10
@jvanschie
jvanschie force-pushed the feature/599-metric-service branch from ea49573 to 7f9d14e Compare May 21, 2026 10:44
@sonarqubecloud

Copy link
Copy Markdown

Comment thread src/mgo_metric_service/client.py
@jvanschie
jvanschie merged commit e7ca2ec into main May 27, 2026
4 checks passed
@jvanschie
jvanschie deleted the feature/599-metric-service branch May 27, 2026 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants